<template>
  <div>
     <div class="head">
      <van-icon class="arrow-left" name="arrow-left" @click="goBack" />
      <p class="title">添加地址</p>
    </div>
    <van-address-edit
  :area-list="areaList"
  show-set-default
  show-search-result
    show-area
  :search-result="searchResult"
  :area-columns-placeholder="['请选择', '请选择', '请选择']"
  @save="onSave"
   @change-detail="onChangeDetail"
/>
  </div>
</template>

<script>
import { Toast } from 'vant';

export default {
 data() {
    return {
      areaList,
      searchResult: [],
    
    };
  },
  methods: {
     goBack(){
        this.$router.back()
    },
    onSave() {
      Toast('save');
    },
    onChangeDetail(val) {
      if (val) {
        this.searchResult = [
          {
            name: '黄龙万科中心',
            address: '杭州市西湖区',
          },
        ];
      } else {
        this.searchResult = [];
      }
    },
  },
}
</script>

<style scoped>
.head {
  height: 45px;
  background-color: antiquewhite;
  text-align: center;
  line-height: 45px;
}
.arrow-left {
  float: left;
  margin: 1rem;
  color: blue;
}
.title {
  text-align: center;
  margin-right: 42px;
}
</style>
